/** @file GOTHethernetcommands.h This file contains all register names for the Ethernet controller 
 * on the Kickass Etherboard.
 * 
 * You NEED the datasheet for this!
 *
 *
 * @author Geoffrey Ottoy - Tom Hamelinckx
 * @date 06/07/2011 (last modified)
 *
 * <pre>
 * MODIFICATION HISTORY:
 *
 * Who  Date     Changes
 * ---- -------- ---------------------------------------------------------
 * TH   06/07/11 Created this file.
 * </pre>
 * 
 */

#ifndef __GOTH_ETH_CMDS_H__
#define __GOTH_ETH_CMDS_H__

//Commands for the ETHERNET controller		//BITINFO:
#define ETH_READ_CR		0b00000000	//3 bits, 5 address
#define ETH_READ_BUFFER		0b00111010	//8 bits
#define	ETH_WRITE_CR		0b01000000	//3 bits, 5 address
#define ETH_WRITE_BUFFER	0b01111010	//8 bits
#define ETH_BITF_SET		0b10000000	//3 bits, 5 address
#define ETH_BITF_CLR		0b10100000	//3 bits, 5 address
#define ETH_SOFT_RESET		0b11111111	//8 bits

//Registernames
//Registervalues consist of 1 byte. The 2 MSbits contain the bank-number, 5 LSbits contain the 
//address
//BANK 0 registers
#define ETH_ERDPTL		0x00
#define	ETH_ERDPTH		0x01
#define	ETH_EWRPTL		0x02
#define ETH_EWRPTH		0x03
#define	ETH_ETXSTL		0x04
#define	ETH_ETXSTH		0x05
#define	ETH_ETXNDL		0x06
#define	ETH_ETXNDH		0x07
#define	ETH_ERXSTL		0x08
#define	ETH_ERXSTH		0x09
#define	ETH_ERXNDL		0x0A	
#define	ETH_ERXNDH		0x0B
#define	ETH_ERXRDPTL	0x0C
#define	ETH_ERXRDPTH	0x0D
#define	ETH_ERXWRPTL	0x0E
#define	ETH_ERXWRPTH	0x0F
#define	ETH_EDMASTL		0x10
#define	ETH_EDMASTH		0x11
#define	ETH_EDMANDL		0x12
#define	ETH_EDMANDH		0x13	
#define	ETH_EDMADSTL	0x14	
#define	ETH_EDMADSTH	0x15
#define	ETH_EDMACSL		0x16
#define	ETH_EDMACSH		0x17

//BANK 1 registers
#define ETH_EHT0		0x40
#define	ETH_ETH1		0x41
#define	ETH_ETH2		0x42
#define ETH_ETH3		0x43
#define	ETH_ETH4		0x44
#define	ETH_ETH5		0x45
#define	ETH_ETH6		0x46
#define	ETH_ETH7		0x47
#define	ETH_EPMM0		0x48
#define	ETH_EPMM1		0x49
#define	ETH_EPMM2		0x4A	
#define	ETH_EPMM3		0x4B
#define	ETH_EPMM4		0x4C
#define	ETH_EPMM5		0x4D
#define	ETH_EPMM6		0x4E
#define	ETH_EPMM7		0x4F
#define	ETH_EPMCSL		0x50
#define	ETH_EDMCSH		0x51
#define	ETH_EPMOL		0x54
#define	ETH_EPMOH		0x55	
#define	ETH_EWOLIE		0x56	
#define	ETH_EWOLIR		0x57
#define	ETH_ERXFCON		0x58
#define	ETH_EPKTCNT		0x19

//BANK 2 registers
#define ETH_MACON1		0x80
#define	ETH_MACON2		0x81
#define	ETH_MACON3		0x82
#define ETH_MACON4		0x83
#define	ETH_MABBIPG		0x84
#define	ETH_MAIPGL		0x86
#define	ETH_MAIPGH		0x87
#define	ETH_MACLCON1	0x88
#define	ETH_MACLCON2	0x89
#define	ETH_MAMXFLL		0x8A	
#define	ETH_MAMXFLH		0x8B
#define	ETH_MAPHSUP		0x8D
#define	ETH_MICON		0x91
#define	ETH_MICMD		0x92
#define	ETH_MIREGADR	0x94	
#define	ETH_MIWRL		0x96	
#define	ETH_MIWRH		0x97
#define	ETH_MIRDL		0x98
#define	ETH_MIRDH		0x99

//BANK 3 registers
#define ETH_MAADR1		0xC0
#define	ETH_MAADR0		0xC1
#define	ETH_MAADR3		0xC2
#define ETH_MAADR2		0xC3
#define	ETH_MAADR5		0xC4
#define	ETH_MAADR4		0xC5
#define	ETH_EBSTSD		0xC6
#define	ETH_EBSTCON		0xC7
#define	ETH_EBSTCSL		0xC8
#define	ETH_EBSTCSH		0xC9	
#define	ETH_MISTAT		0xCA
#define	ETH_EREVID		0xD2
#define	ETH_ECOCON		0xD5
#define	ETH_EFLOCON		0xD7
#define	ETH_EPAUSL		0xD8	
#define	ETH_EPAUSH		0xD9


//PHY registers
#define PHCON1			0x00
#define PHSTAT1			0x01
#define	PHID1			0x02
#define PHID2			0X03
#define PHCON2			0x10
#define	PHSTAT2			0x11
#define	PHIE			0x12
#define	PHIR			0x13
#define	PHLCON			0x14

//Universal registernames
//Bank independent
#define	ETH_EIE			0x1B
#define	ETH_EIR			0x1C
#define	ETH_ESTAT		0x1D
#define	ETH_ECON2		0x1E
#define	ETH_ECON1		0x1F

#endif

